import java.util.*;
public class Room 
{
    public String description;
    private Map<String, Room> map;
    Thing thing = null;
    //public Room northExit;
    //public Room southExit;
    //public Room eastExit;
    //public Room westExit;
    //public Room upExit;
    //public Room downExit;

    /**
     * Create a room described "description". Initially, it has
     * no exits. "description" is something like "a kitchen" or
     * "an open court yard".
     * @param description The room's description.
     */
    public Room(String description) 
    {
        this.description = description;
        this.map = new HashMap<>();
    }
    
    
    public Room(String description,Thing thing){
        this(description);
        this.thing = thing;
    
    }
        
    public void setExit(String direction,Room exit) {
        this.map.put(direction, exit);
    }

    public Room goRoom(String direction){
        return this.map.get(direction);
    }
    
    public void printExits(){
        System.out.println("方向: ");
        for(String key : map.keySet()) {
            System.out.print(key + " ");
        }
        System.out.println();
    }
    
    public String getDescription()
    {
        return description;
    }
    
    public String getThing() {
        if(this.thing!=null)
            return this.thing.getName();
        else{
            System.out.println("这里是空的噢");
            return " ";
        }
    }
    
    public Thing getThings() {
        return this.thing;
    }
    
    public void removeThing() {
        this.thing = null;
    }

}
